<!DOCTYPE html>
<html>
<head>
	<title>Load options and set value in async mode</title>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
	<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
	<link rel="stylesheet" type="text/css" href="../../../codebase/fonts/font_roboto/roboto.css"/>
	<link rel="stylesheet" type="text/css" href="../../../codebase/dhtmlx.css"/>
	<script src="../../../codebase/dhtmlx.js"></script>
	<script>
		var myForm, formData;
		function log(message) {
			document.getElementById('log_div').innerHTML+="<div>"+message+"</div>";
		}
		function doOnLoad() {
			formData = [
				{type: "settings", position: "label-left", labelWidth: 100, inputWidth: 140},
				{type: "fieldset", label: "Welcome", inputWidth: "auto", list:[
					{type: "select", label: "Package", name: "package", connector: "php/opts_async_options.php?t=select"},
					{type: "combo", label: "Format", name: "format", connector: "php/opts_async_options.php?t=combo"}
				]}
			];
			myForm = new dhtmlXForm("myForm", formData);
			myForm.attachEvent("onOptionsLoaded", function(name){
				log((name=="package"?"select":"combo")+" options loaded");
			});
			myForm.load("php/opts_async_values.php", function(){
				log("values loaded");
			});
		}
	</script>
</head>
<body onload="doOnLoad();">
	<div id="myForm"></div>
	<div id="log_div" style='clear:both; padding:10px; font-family:monospace;'></div>
</body>
</html>
